package com.itheima.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Auther LCSlove
 * @Date 2021-09-08 23:13
 */
@Configuration
public class RabbitConfig {
    @Bean
    public TopicExchange topicExchange() {
        return new TopicExchange("topic_exchange_springboot");
    }

    @Bean
    public Queue createQueue() {
        return new Queue("topic_queue_springboot");
    }

    @Bean
    public Binding createBinding() {
        return BindingBuilder.bind(createQueue()).to(topicExchange()).with("item.*");
    }
}
